<?php

namespace App\Models\Goods;

use Illuminate\Database\Eloquent\Model;
use App\Http\Controllers\Serve\Category as CategoryModel;
class Category extends Model
{
    /**
     * 关联到模型的数据表
     *
     * @var string
     */
    protected $table = 'category';

    public static function getAllCategory(){
        $categorys = self::all(['id', 'pid', 'name'])->toArray();
        return $categorys ?? [] ;
    }

//    public static function getTreeCategory(){
//        $data = self::all()->toArray();
//        $categorys = CategoryModel::getTree($data);
//        return $categorys;
//    }

}
